package com.ai.bitcoin.jpa.service.impl;

import com.ai.bitcoin.jpa.dao.BccBatchDao;
import com.ai.bitcoin.jpa.entity.BccBatch;
import com.ai.bitcoin.jpa.service.BccBatchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * @author Jason
 * @date 2018/3/29
 **/
@Component
public class BccCrawlBatchServiceImpl implements BccBatchService {
    @Autowired
    BccBatchDao dao;

    @Override
    public BccBatch save(BccBatch bccBatch) {
        return dao.save(bccBatch);
    }

    @Override
    public List<BccBatch> findByBatchTypeAndBatchStateOrderByBatchTimeEndDesc(String bathType, String batchState) {
        return dao.findByBatchTypeAndBatchStateOrderByBatchTimeEndDesc(bathType, batchState);
    }

    @Override
    public BccBatch findOneByBatchTypeAndBatchStateOrderByBatchTimeEndDesc(String bathType, String batchState) {
        return dao.findOneByBatchTypeAndBatchStateOrderByBatchTimeEndDesc(bathType, batchState);
    }

    @Override
    public List<BccBatch> findByBatchTypeAndBatchStateAndBatchTimeEndGreaterThan(String bathType, String batchState, Date date) {
        return dao.findByBatchTypeAndBatchStateAndBatchTimeEndLessThan(bathType, batchState, date);
    }
}
